#pragma once

#ifndef __CORE_RefCounted_H__
#define __CORE_RefCounted_H__

/*!
 * \file RefCounted.h
 * 
 * \brief Contains the class declaration of the class that implements reference counting
 *
 * Contains the class declaration of the class that implements reference counting
 *
 * \author Jorge Barrio Alfonso
 * \version 1.0
 */

#include "FLOW_core/namespace.h"
#include "FLOW_core/core_types.h"

namespace CORE
{
	/*!
	 * \brief Class that implements the reference counting on objects
	 *
	 * Class that implements the reference counting on objects
	 */
	class CRefCounted
	{
	public:
		//============== METHODS ==============================================
		//! Constructor
		CRefCounted( );

		//! Virtual destructor
		virtual ~CRefCounted( );

		//! Copy constructor, does not copy reference count
		CRefCounted( const CRefCounted& ar_ref_counted );

		//! Increase by one the reference count, it has the ellipsis argument to accept 
		//! any argument the smart ptr could pass but it ignores the argument completely
		void AddRef( );

		//! Decrease by one the reference count, it has the ellipsis argument to accept 
		//! any argument the smart ptr could pass but it ignores the argument completely
		void DecRef( );

		//! Returns the number of references this object has on it
		u32_t GetRefCount( void ) const;

		//! Assignment operator
		CRefCounted& operator = ( const CRefCounted& ar_ref_counted );

	private:
		//=================== DATA MEMBERS ====================================
		//! Reference count for this object, it's mutable to allow const
		//! objects be reference counted
		mutable s32_t m_ref_count;
	};

} //end namespace CORE
#endif
